package com.imu.purse.modules.trade.form;

import com.alibaba.fastjson.annotation.JSONField;
import com.imu.common.validator.group.AddGroup;
import com.imu.common.validator.group.UpdateGroup;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import org.hibernate.validator.constraints.NotBlank;

import javax.persistence.Column;
import javax.validation.constraints.Min;
import javax.validation.constraints.NotNull;
import java.math.BigDecimal;

@Data
public class ExchangeForm {
    //付款账号
    @JSONField(ordinal = 1)
    @NotBlank(message="付款账号不能为空", groups = {AddGroup.class, UpdateGroup.class})
    @ApiModelProperty(value="付款账号", name="payAccount", required = true, example="13800000000")
    private String payAccount;

    @JSONField(ordinal = 2)
    @NotBlank(message="订单号不能为空", groups = {AddGroup.class, UpdateGroup.class})
    @ApiModelProperty(value = "订单号", name="orderNo", required = true, example="201801010100111")
    private String orderNo;

    @JSONField(ordinal = 3)
    @ApiModelProperty(value = "兑换金额", name="money", required = true, example="100")
    @NotNull(message="兑换金额", groups = {AddGroup.class, UpdateGroup.class})
    @Min(value=1, message="交易余额必须大于0", groups = {AddGroup.class, UpdateGroup.class})
    private BigDecimal money;

    @JSONField(ordinal = 4)
    @ApiModelProperty(value = "描述", hidden = true)
    private String detail;

    /**
     * 0代表imu，1:代表以太坊
     * 关于字段ytfType 类型，值分别为0:IMU,1:以太坊,2:易买包,3:KTC,4:GET
     */
    @JSONField(ordinal = 5)
    @Column(name="ytfType")
    @ApiModelProperty(value = "以太坊类型", name="ytfType", required = true, example="0,1")
    private Integer ytfType;

}
